<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script> -->
       <!-- 引入Vue 全局注册一个名为Vue的构造函数 -->
       <script src="../js/vue.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        {{message}}
         {{field()}}
 <!-- isActive?green:black -->

 <button @click="isActive=!isActive">111</button>
 <p :class="[isActive ? 'green':'black']">背景颜色</p>

</div>
 <script>
     var app =new Vue(
         {
             //element的缩写，挂载元素
             el:"#app",
             data:{
          message:"Hello Vue!",
          isActive:true
             },
             methods: {
                field(){
                    return 12;
                }
             },
         }
     )

     console.log(app.isActive);
 </script>

 <style>
    /* style中花括号之间没有分号 */
 .green{
    background-color: green;
}

 .black{
   background-color: black;
}

 </style>
</body>
</html>